Get Translation Suggestion
Used to get AI-powered translation suggestions for UI elements. This API analyzes the context of an element and provides appropriate translations based on its type, application context, and detailed usage information.
API Endpoint
| Property | Value |
|---|---|
| Request Method | POST |
| Request URL | https://api.seliseblocks.com/uilm/v1/Assistant/GetTranslationSuggestion |
Request
Request Example
curl -X POST 'https://api.seliseblocks.com/uilm/v1/Assistant/GetTranslationSuggestion' \
-H 'accept: */*' \
-H 'Content-Type: application/json' \
-H 'x-blocks-key: YOUR_PROJECT_KEY' \
-d '{
"elementType": "button",
"elementApplicationContext": "login_form",
"elementDetailContext": "Primary action button for submitting login credentials",
"temperature": 0.7,
"maxCharacterLength": 50,
"sourceText": "Log In",
"destinationLanguage": "de-DE",
"currentLanguage": "en-US"
}'
Request Headers
| Field | Type | Required | Description |
|---|---|---|---|
| accept | string | Yes | Accepted response format. Use */* |
| Content-Type | string | Yes | Request body format. Must be application/json |
| x-blocks-key | string | Yes | Your project authentication key |
Request Body
Request Body Schema
{
"elementType": "string",
"elementApplicationContext": "string",
"elementDetailContext": "string",
"temperature": 0,
"maxCharacterLength": 0,
"sourceText": "string",
"destinationLanguage": "string",
"currentLanguage": "string"
}
Request Body Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| elementType | string | Yes | Type of UI element (e.g., button, label, heading, placeholder, tooltip, error_message) |
| elementApplicationContext | string | Yes | Application context (e.g., login_form, dashboard, user_profile) |
| elementDetailContext | string | Yes | Detailed description of element purpose and usage |
| temperature | number | No | Creativity control (0.0-1.0). Default: 0.7 |
| maxCharacterLength | integer | No | Maximum character length for translation output |
| sourceText | string | Yes | Text to be translated |
| destinationLanguage | string | Yes | Target language code (e.g., de-DE, fr-FR, es-ES) |
| currentLanguage | string | Yes | Source language code (e.g., en-US, en-GB) |
Response
Success Response (200 OK)
{
"suggestions": [
{
"translation": "Anmelden",
"confidence": 0.95,
"characterCount": 8,
"explanation": "Standard translation for login button in German.",
"alternativePhrasings": ["Einloggen", "Login"]
}
],
"contextAnalysis": {
"elementType": "button",
"applicationContext": "login_form",
"recommendedStyle": "concise_action_oriented",
"culturalNotes": "German translations tend to be more formal than English."
}
}
Error Codes
| Status Code | Description | Response Type |
|---|---|---|
| 400 | Invalid request parameters or missing required fields | Bad Request |
| 401 | Missing or invalid project key | Unauthorized |